package cn.hesion.leetcode;


import java.util.List;

/**
 * //用线段树实现
 * //1 怎么存线段树
 */
public class RectangleArea {
    List<RectTreeNode> nodes;
    int[] Y;


    public int getValue(int idx) {
        return Y[idx];
    }

    public int getIndex(int value) {
        int r = 0, l = Y.length - 1;
        while (l < r) {
            int mid = (l + r) >> 1;
            if (Y[mid] == value) {
                return mid;
            } else if (Y[mid] < value) {
                l = mid + 1;
            } else if (Y[mid] > value) {
                r = mid-1;
            }
        }
        return -1;
    }
}

class RectTreeNode {
    int x;
    int y1, y2;

    //出入
    int v;

    public RectTreeNode() {
    }

    public RectTreeNode(int x, int y1, int y2, int v) {
        this.x = x;
        this.y1 = y1;
        this.y2 = y2;
        this.v = v;
    }
}

class SegNode{
    SegNode left,right;
    int len;
    int cover;


    public SegNode() {
        this.left = this.right=null;
        this.len = 0;
        this.cover = 0;
    }
}
